//登录界面的非空限制
function loginbeforeSubmit(form){
    if(form.account.value==''){
        alert('账号不能为空！');
        form.account.focus();
        return false;
    }
    if(form.password.value==''){
        alert('密码不能为空！');
        form.password.focus();
        return false;
    }
    return true;
}

//注册界面的非空限制
function registerbeforeSubmit(form){
    if(form.userName.value==''){
        alert('用户名不能为空！');
        form.userName.focus();
        return false;
    }
    if(form.userName.value.length>8){
        alert('用户名过长！');
        form.userName.focus();
        return false;
    }
    if(form.account.value==''){
        alert('账号不能为空！');
        form.account.focus();
        return false;
    }

    if(form.account.value.length>8){
        alert('账号过长！');
        form.account.focus();
        return false;
    }

    if(form.password.value==''){
        alert('密码不能为空！');
        form.password.focus();
        return false;
    }

    if(form.password.value.length>20){
        alert('密码过长！');
        form.password.focus();
        return false;
    }

    if(form.password.value.length<6){
        alert('密码至少为6位，请重新输入！');
        form.password.focus();
        return false;
    }

    if(form.confirmPassword.value==''){
        alert('再次确认密码不能为空！');
        form.confirmPassword.focus();
        return false;
    }

    if(form.password.value!=form.confirmPassword.value) {
        alert('你两次输入的密码不一致，请重新输入！');
        form.confirmPassword.focus();
        return false;
    }


    if(form.phonenumber.value==''){
        alert('手机号不能为空！');
        form.phonenumber.focus();
        return false;
    }

    if(form.sex.value==''){
        alert('性别不能为空！');
        form.sex.focus();
        return false;
    }

    if(form.address.value==''){
        alert('地址不能为空！');
        form.address.focus();
        return false;
    }
    return true;
}

//图书录入的非空限制
function bookInfo(form){
    if(form.name.value==''){
        alert('图书名不能为空！');
        form.name.focus();
        return false;
    }
    if(form.author.value==''){
        alert('作者名不能为空！');
        form.author.focus();
        return false;
    }
    if(form.publisher.value==''){
        alert('出版社不能为空！');
        form.publisher.focus();
        return false;
    }
    if(form.price.value==''){
        alert('价格不能为空！');
        form.price.focus();
        return false;
    }
    return true;
}

//基本信息非空限制
function personal_information1_beforeSubmit(form){
    if(form.userName.value==''){
        alert('用户名不能为空！');
        form.userName.focus();
        return false;
    }

    if(form.phonenumber.value==''){
        alert('联系方式不能为空！');
        form.phonenumber.focus();
        return false;
    }
    if(form.addr2.value==''){
        alert('地址不能为空！');
        form.addr2.focus();
        return false;
    }
    return true;
}

//修改密码限制
function passwordchangebeforeSubmit(form){
    if(form.newPassword.value==''){
        alert('密码不能为空！');
        form.newPassword.focus();
        return false;
    }

    if(form.newPassword.value.length>20){
        alert('密码过长！');
        form.newPassword.focus();
        return false;
    }

    if(form.newPassword.value.length<6){
        alert('密码至少为6位，请重新输入！');
        form.newPassword.focus();
        return false;
    }

    if(form.confirmPassword.value==''){
        alert('再次确认密码不能为空！');
        form.confirmPassword.focus();
        return false;
    }

    if(form.newPassword.value!=form.confirmPassword.value) {
        alert('你两次输入的密码不一致，请重新输入！');
        form.confirmPassword.focus();
        return false;
    }
    return true;
}


//搜索图书界面非空限制
function navigationbeforeSubmit(form){
    if(form.bookNameAuthor.value==''){
        alert('搜索内容不能为空！');
        form.bookNameAuthor.focus();
        return false;
    }

    return true;
}
//订单查询非空限制
function orderquerybeforeSubmit(form){
    if(form.orderInfo.value==''){
        alert('搜索内容不能为空！');
        form.orderInfo.focus();
        return false;
    }

    return true;
}
//申请回收界面非空限制
function requestrecycling(form){

    if(form.nameOfBook.value==''){
        alert('二手书名称不能为空！');
        form.nameOfBook.focus();
        return false;
    }
    if(form.description.value==''){
        alert('二手书描述不能为空！');
        form.description.focus();
        return false;
    }
    if(form.numberOfBook.value==''){
        alert('二手书数量不能为空！');
        form.numberOfBook.focus();
        return false;
    }
    if(form.phonenumber.value==''){
        alert('电话号码不能为空！');
        form.phonenumber.focus();
        return false;
    }
    if(form.address.value==''){
        alert('详细地址不能为空！');
        form.address.focus();
        return false;
    }
    return true;
}
//定价界面限制
function finpricebeforeSubmit(form){

    if(form.ordId.value==''){
        alert('订单号不能为空！');
        form.ordId.focus();
        return false;
    }
    if(form.bookName.value==''){
        alert('二手书名称不能为空！');
        form.bookName.focus();
        return false;
    }
    
    if(form.bookAmount.value==''){
        alert('二手书数量不能为空！');
        form.bookAmount.focus();
        return false;
    }

    if(form.finalPrice.value==''){
        alert('最终定价不能为空！');
        form.finalPrice.focus();
        return false;
    }
    return true;
}
